﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace INdTFramework.Commons.Converters
{
    public class DateTimeConverter : IValueConverter
    {
        private String _pattern;
        public String Pattern 
        { 
            get
            {
                return _pattern;
            }
            set
            {
                _pattern = String.Format ("{{0:{0}}}", value);
            }
        }

        public DateTimeConverter()
        {
            Pattern = "dd/MM/yyyy";
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return String.Format(Pattern, value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
